<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="plugins/elementui/index.css">
    <link rel="stylesheet" href="css/login.css">
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="css/style.css">
    <script src="js/axios-0.18.0.js"></script>
</head>
<body class="hold-transition skin-purple sidebar-mini">
<div id="app">
    <div class="login-container">
        <div class="loginBox">
            <el-form label-position="right" label-width="100px">
                <div class="title-container">
                    <div class="logoInfo clearfix">
                        <em class="logo"></em>
                    </div>
                </div>
                <div>
                        <span class="svg-container svg-container_login">
                          <span class="user"></span>
                        </span>
                    <input type="password" name="currentPassword" v-model="password.currentPassword" placeholder="请输入当前密码"/>
                </div>
                <div>
                    <span class="svg-container svg-container_login">
                          <span class="username"></span>
                        </span>
                    <input type="password" name="newPassword" v-model="password.newPassword" placeholder="请输入新密码"/>
                </div>
                <input type="button" style="width:50%;margin-bottom:30px;" @click="update" value="修改密码"></input>
                <a  style="float: right" href="retrievepassword.html">忘记密码?</a>
            </el-form>
        </div>
    </div>
</div>
</body>
<!-- 引入组件库 -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="js/vue.js"></script>
<script src="plugins/elementui/index.js"></script>
<script>
    var vue = new Vue({
        el:'#app',
        data:{
            password:{}
        },
        methods:{
            update () {
                var params = new URLSearchParams();
                params.append("currentPassword",this.password.currentPassword);
                params.append("newPassword",this.password.newPassword)
                axios.post("/user/updatepassword.do",params).then(function (res) {
                    if (res.data.flag){
                        window.location.href='skip.html'
                    } else {
                        vue.$message.error(res.data.message)
                    }
                })
            }
        }
    })
</script>
</html>
